﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<JLL.China.Web.Areas.Portal.Models.PortalModel>" %>
<!-- start id-form -->
<%--	<form action="" class="validateform" method="post" id="formID">--%>
<% using (Html.BeginForm("Step1", ViewData["ActionPost"].ToString(), FormMethod.Post, new { id = "formID", enctype = "multipart/form-data", @class = "validateform" }))
   { %>
<%--<input type="hidden" name="CategoryID" value="<%=ViewData["CategoryID"].ToString()%>" />
        <input type="hidden" name="NewsContentID" value="<%=(this.Model!=null)?(this.Model.ID!=null)?this.Model.ID.ToString():"0":"0"%>" />      	--%>
<% = Html.HiddenFor(x => x.NewsModel.NewCategoryFID) %>
<% = Html.HiddenFor(x => x.NewsModel.NewsId) %>
<% = Html.HiddenFor(x => x.NewsModel.CreatedBy) %>
<% = Html.HiddenFor(x => x.NewsModel.DateCreated) %>
<% = Html.HiddenFor(x => x.NewsModel.DateUpdated) %>
<% = Html.HiddenFor(x => x.NewsModel.Thumbnail) %>
<table border="0" cellpadding="0" cellspacing="0" id="id-form" width="100%">
    <tr>
        <th valign="top">
            <span class="mandate">*</span>Title:
        </th>
        <td width="40%">
            <%--  <input type="text" name="title" id="title" class="validate[required]  inp-form" value="<%=(this.Model!=null)?this.Model.Title.ToString():""%>" style="width:500px"/>--%>
            <br />
            <b>English</b><br />
            <br />
            <%= Html.TextBoxFor(m => m.NewsModel.Title, new { name = "title", id = "title", @class = "validate[required] inp-form", style = "width:97%" })%>
        </td>
        <td class="style2" width="10px">
            &nbsp;
        </td>
        <td width="40%">
            <br />
            <b>Local</b><br />
            <br />
            <%= Html.TextBoxFor(m => m.NewsModel_Local.Title, new { name = "title_local", id = "title_local", @class = "validate[required] inp-form", style = "width:97%" })%>
        </td>
    </tr>
    <tr>
        <th valign="top">
            <span class="mandate">*</span> Status:
        </th>
        <td width="40%">
            <%--<select  class="chzn-nosearch chz" id="status" name="status">
                    <option value="1">Active</option>
                    <option value="0">Inactive</option>
                </select>--%>
            <div class="select_holder">
                <%=Html.DropDownListFor(m => m.NewsModel.Status, new List<SelectListItem>
                     {
                        new SelectListItem{Selected = true, Text="Active", Value = "true" }, 
                        new SelectListItem{Selected = false, Text="Inactive", Value = "false" },
                     }, new { id = "news_status", name = "news_status", @class = "chzn-nosearch chz" })%>
            </div>
        </td>
        <td>
            &nbsp;
        </td>
        <td width="40%">
            &nbsp;
        </td>
        <td>
        </td>
    </tr>
    <tr>
        <th>
            Thumbnail
        </th>
        <td width="45%">

            <script>
                                    function checkFileExtension(elem) {
                                        var filePath = elem.value;


                                        if (filePath.indexOf('.') == -1)
                                            return false;


                                        var validExtensions = new Array();
                                        var ext = filePath.substring(filePath.lastIndexOf('.') + 1).toLowerCase();


                                        validExtensions[0] = 'jpg';
                                        validExtensions[1] = 'jpeg';
                                        validExtensions[2] = 'bmp';
                                        validExtensions[3] = 'png';
                                        validExtensions[4] = 'gif';



                                        for (var i = 0; i < validExtensions.length; i++) {
                                            if (ext == validExtensions[i])
                                                return true;
                                        }


                                        alert('The file extension ' + ext.toUpperCase() + ' is not allowed!');
                                        $('#inputfile').empty();
                                        $('#inputfile').html('<input type="file" onchange="checkFileExtension(this);" name="thumnail" id="thumnail" size="50" />');
                                        return false;
                                    }
                                </script>
<div id="inputfile">
            <input type="file" name="thumnail" onchange="checkFileExtension(this);" id="thumnail" size="50" />
            </div>
        </td>
        <td width="10%">
            &nbsp;
        </td>
        <td width="45%">
            &nbsp;
            <% if (this.Model != null)
               {%>
            <img id="imgPreview" width="100px" height="100px" src="<%=Url.Content("~/")%>News/ShowThumbnail/<%=this.Model.NewsModel.NewsId%>" />
            <% } %>
        </td>
    </tr>
    <tr>
        <td colspan="5">
            <div class="form_divider">
            </div>
        </td>
        <!--------------------------------------------------------------------->
    </tr>
    <tr>
        <th valign="middle" width="40px">
            <span class="mandate">*</span>Article Snipplet:
        </th>
        <td style="width: 600px;" align="left" valign="middle" width="40%">
            <input id="summary_validate" class="validate[required]" style="visibility: hidden;
                height: 0; width: 0" />
            <br />
            <b>English</b><br />
            <br />
            <%= Html.TextAreaFor(m => m.NewsModel.Summary, new { id = "summary", name = "summary", @class = "ckeditors", cols = "88", rows = "10", style = "width:100%" })%>
        </td>
        <td align="left" valign="middle" class="style2" width="10px">
            &nbsp;
        </td>
        <td style="width: 600px;" align="left" valign="middle" width="40%">
            <input id="summary_local_validate" class="validate[required]" style="visibility: hidden;
                height: 0; width: 0" />
            <br />
            <b>Local</b><br />
            <br />
            <%= Html.TextAreaFor(m => m.NewsModel_Local.Summary, new { id = "summary_local", name = "summary_local", @class = "ckeditors", cols = "88", rows = "10", style = "width:100%" })%>
        </td>
    </tr>
    <tr>
        <td colspan="5">
            <div class="form_divider">
            </div>
        </td>
        <!--------------------------------------------------------------------->
    </tr>
    <tr>
        <th valign="middle" width="40px">
            <span class="mandate">*</span>Article Main Content:
        </th>
        <td style="width: 600px;" align="left" valign="middle" width="40%">
            <input id="content_validate" class="validate[required]" style="visibility: hidden;
                height: 0; width: 0" />
            <br />
            <b>English</b><br />
            <br />
            <%= Html.TextAreaFor(m => m.NewsModel.Content, new { id = "contentID", name = "content", @class = "ckeditors", cols = "88", rows = "10", style = "width:100%" })%>
        </td>
        <td align="left" valign="middle" class="style2" width="10px">
            &nbsp;
        </td>
        <td style="width: 600px;" align="left" valign="middle" width="40%">
            <input id="content_local_validate" class="validate[required]" style="visibility: hidden;
                height: 0; width: 0" />
            <br />
            <b>Local</b><br />
            <br />
            <%= Html.TextAreaFor(m => m.NewsModel_Local.Content, new { id = "content_local", name = "content_local", @class = "ckeditors", cols = "88", rows = "10", style = "width:100%" })%>
        </td>
    </tr>
    <tr>
        <td colspan="5">
            &nbsp;
        </td>
    </tr>
    <tr>
        <%--   <th>&nbsp;</th>
            <td valign="top">
                <input type="submit" value="Submit" class="buttons" onclick="checkForm()" />
                <input type="reset" value="Reset" class=""  />
            </td>
            <td valign="top">
                &nbsp;</td>
            <td valign="top">
                &nbsp;</td>
            <td></td>--%>
        <th>
            &nbsp;
        </th>
        <td valign="top" align="center" colspan="5">
            <input type="submit" value="Submit" onclick="checkForm()" class="buttons" style="margin-right: 8px;
                float: right" />
            <%--<input type="submit" value="" class="form-submit" onclick=" checkFormAndUpload(); " />--%>
            <input type="reset" value="Reset" class="buttons" style="margin-right: 8px; float: right" />
        </td>
    </tr>
    <tr style="visibility: hidden; height: 0">
        <th valign="top">
            <span class="mandate">*</span>Slug:
        </th>
        <td>
            <%--<input type="text" name="slug" id="slug" class="validate[required]  inp-form" value="<%=(this.Model!=null)?this.Model.Slug.ToString():""%>"/>--%>
            <%= Html.TextAreaFor(m => m.NewsModel_Local.Slug, new { id = "slug", name = "slug", @class = "ckeditors", cols = "88", rows = "10", style = "width:100%" })%>
        </td>
        <td>
            &nbsp;
        </td>
        <td>
            &nbsp;
        </td>
    </tr>
</table>
<%--   </form>--%>
<%} %>
<!-- end id-form  -->
